package com.test;

import java.util.ArrayList;

public class wev {
   static int sum = 0;
    //int num = 0;
   static int flag = 1;
   ArrayList list =new ArrayList();
    public  ArrayList jiaHe() {
        selectJiaHe(flag, sum);
        return list;
    }
    //相加
    ArrayList selectJiaHe(int flag, int sum) {
        if(flag <= 10){
            sum  = flag + sum;
            if (flag==10)
                list.add(sum);
            flag+=1;
            selectJiaHe(flag,sum);
        }
        return list;
    }

    public static void main(String[] args) {
        wev wev =new wev();
        ArrayList arrayList = wev.jiaHe();
        System.out.println( arrayList.toString());
    }
}
